/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clases;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author jackercito
 */
@Entity
@Table(name = "CURSO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Curso.findAll", query = "SELECT c FROM Curso c ORDER BY c.curso"),
    @NamedQuery(name = "Curso.findByIdcurso", query = "SELECT c FROM Curso c WHERE c.idcurso = :idcurso"),
    @NamedQuery(name = "Curso.findByCurso", query = "SELECT c FROM Curso c WHERE c.curso = :curso"),
    @NamedQuery(name = "Curso.findByAsignatura", query = "SELECT c FROM Curso c WHERE c.asignatura = :asignatura")})
public class Curso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDCURSO")
    private Integer idcurso;
    @Column(name = "CURSO")
    private Integer curso;
    @Size(max = 50)
    @Column(name = "ASIGNATURA")
    private String asignatura;
    @OneToMany(mappedBy = "idcursofk")
    private Collection<Usuariocurso> usuariocursoCollection;
    @OneToMany(mappedBy = "idcrusofk")
    private Collection<Cursopractica> cursopracticaCollection;

    public Curso() {
    }

    public Curso(Integer idcurso) {
        this.idcurso = idcurso;
    }

    public Integer getIdcurso() {
        return idcurso;
    }

    public void setIdcurso(Integer idcurso) {
        this.idcurso = idcurso;
    }

    public Integer getCurso() {
        return curso;
    }

    public void setCurso(Integer curso) {
        this.curso = curso;
    }

    public String getAsignatura() {
        return asignatura;
    }

    public void setAsignatura(String asignatura) {
        this.asignatura = asignatura;
    }

    @XmlTransient
    public Collection<Usuariocurso> getUsuariocursoCollection() {
        return usuariocursoCollection;
    }

    public void setUsuariocursoCollection(Collection<Usuariocurso> usuariocursoCollection) {
        this.usuariocursoCollection = usuariocursoCollection;
    }

    @XmlTransient
    public Collection<Cursopractica> getCursopracticaCollection() {
        return cursopracticaCollection;
    }

    public void setCursopracticaCollection(Collection<Cursopractica> cursopracticaCollection) {
        this.cursopracticaCollection = cursopracticaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcurso != null ? idcurso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Curso)) {
            return false;
        }
        Curso other = (Curso) object;
        if ((this.idcurso == null && other.idcurso != null) || (this.idcurso != null && !this.idcurso.equals(other.idcurso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return curso + "º- " + asignatura;
    }
    
}
